package Deom1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2023-11-19
 * Time: 20:37
 */
class Dog extends Animal {
    public void wag() {
        System.out.println(this.name+"摇尾巴");
    }
}
class Cat extends Animal {
    public void barks() {
        System.out.println(this.name+"喵喵叫");
    }
}
public class Animal {
    //成员变量
    public String name;
    public String color;
    public int age;
    //成员方法
    public void eat() {
        System.out.println(this.name+"正在吃");
    }
    public void sleep() {
        System.out.println(this.name+"正在睡觉");
    }

    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.eat();//eat() sleep() 都是从父类Animal继承过来的
        cat.sleep();
        cat.barks();//这是cat自己特有的
        Dog dog = new Dog();
        dog.sleep();//eat() sleep() 都是从父类Animal继承过来的
        dog.eat();
        dog.wag();//这是dog特有的
    }
}

